/********************************************************************************
 * @file   gkt_compiler_armcc.h
 * @brief  ARMCLANG (ARM compiler V6) compiler header file
 * @date   8/Oct/2018
 ********************************************************************************/
 
#ifndef GKT_COMPILER_ARMCLANG_H
#define GKT_COMPILER_ARMCLANG_H

#ifndef __ARM_COMPAT_H
#include <arm_compat.h>    /* Compatibility header for ARM Compiler 5 intrinsics */
#endif

#ifndef __ASM
#define __ASM	__asm
#endif

#ifndef __INLINE
#define __INLINE	__inline
#endif

#ifndef __STATIC_INLINE
#define __STATIC_INLINE	static __inline
#endif

#ifndef __NO_RETURN
#define __NO_RETURN	__attribute__((noreturn))
#endif

#ifndef __USED
#define __USED	__attribute__((used))
#endif

#ifndef __WEAK
#define __WEAK	__attribute__((weak))
#endif

#ifndef __UNALIGNED_UINT32
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpacked"
struct __attribute__((packed)) T_UINT32 { uint32_t v; };
#pragma clang diagnostic pop
#define __UNALIGNED_UINT32(x)	(((struct T_UINT32 *)(x))->v)
#endif

#ifndef __ALIGNED
#define __ALIGNED(x) __attribute__((aligned(x)))
#endif

#ifndef __PACKED
#define __PACKED	__attribute__((packed, aligned(1)))
#endif

#ifndef __PACKED_STRUCT
#define __PACKED_STRUCT	struct __attribute__((packed, aligned(1)))
#endif

#ifndef __SECTION
#define __SECTION(name)	__attribute__((__section__(#name)))
#endif

#endif	/* GKT_COMPILER_ARMCLANG_H */

